package com.tmsps.ne4weixin.bean.message.send;

import java.util.LinkedList;
import java.util.List;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.tmsps.ne4weixin.annotation.XStreamCDATA;
import com.tmsps.ne4weixin.bean.message.event.BaseEvent;
import com.tmsps.ne4weixin.bean.message.receive.InBaseMessage;
import com.tmsps.ne4weixin.bean.message.send.vo.Article;
import com.tmsps.ne4weixin.config.enumeration.MsgTypeEnum;

import lombok.Getter;
import lombok.Setter;

/**
 * @Title: NewsMessage.java
 * @Package: com.tmsps.ne4weixin.bean.send
 * @Description: 被动回复用户消息-回复图文消息
 * @author: hanjiefei
 * @date: 2019-10-18
 * @version V1.0
 * @Copyright: 2019
 */
@XStreamAlias("xml")
@Setter
@Getter
public class OutNewsMessage extends OutBaseMessage {

	/**
	 * 必填 是 图文消息个数； 当用户发送文本、图片、视频、图文、地理位置这五种消息时，开发者只能回复1条图文消息； 其余场景最多可回复8条图文消息
	 */
	@XStreamAlias("ArticleCount")
	private Integer articleCount;

	/**
	 * 必填 是 图文消息信息，注意，如果图文数超过限制，则将只发限制内的条数
	 */
	@XStreamCDATA(join = true)
	@XStreamAlias("Articles")
	private List<Article> articles = new LinkedList<Article>();

	public OutNewsMessage(List<Article> articles) {
		super(MsgTypeEnum.NEWS);
		this.articleCount = articles.size();
		this.articles = articles;
	}

	public OutNewsMessage(InBaseMessage message) {
		super(message, MsgTypeEnum.NEWS);
	}
	
	public OutNewsMessage(BaseEvent event) {
		super(event, MsgTypeEnum.NEWS);
	}

}
